package com.thinkgem.jeesite.modules.state;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum ClientTypeEnum {
	SELL(1, "买卖客户"),
	RENT(2, "租赁客户");

	private Integer key;
	private String value;

	public Integer getKey() {
		return key;
	}

	public void setKey(Integer key) {
		this.key = key;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	private ClientTypeEnum(Integer key, String value) {
		this.key = key;
		this.value = value;
	}

	// 普通方法
	// 取得 value
	public static String getValue(int index) {
		for (ClientTypeEnum item : ClientTypeEnum.values()) {
			if (item.getKey() == index) {
				return item.value;
			}
		}
		return null;
	}

	// 把 enum 转为 list 使用
	public static List<Map> getList() {
		List<Map> list = new ArrayList();
		Map map = null;
		for (ClientTypeEnum item : ClientTypeEnum.values()) {
			map = new HashMap();
			map.put("key", item.getKey());
			map.put("value", item.getValue());

			list.add(map);
		}
		return list;
	}
}
